﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DictionaryHW
{
    class Utils
    {
        //Returns True if Input string contains only letters and spaces
        public static bool IsOnlyLetters(string inputString)
        {
            foreach (char c in inputString)
            {
                if (((c < 65) || (c > 122)) && (c != 32)) return false;
            }
            return true;
        }
        //Returns True if Input string contains only digits
        public static bool IsDigitNumber(string number)
        {
            foreach (char c in number)
            {
                if ((c < 48) || (c > 57)) return false;
            }
            return true;
        }
        //Getting number from Input
        public static int GetNumber()
        {
            string number = Console.ReadLine();
            if (IsDigitNumber(number))
            {
                return Convert.ToInt32(number);
            }
            else
            {
                Console.WriteLine("Input must contain only digits");
                return GetNumber();
            }
        }
        //Get Word
        public static string GetOnlyLetters()
        {
            string str = Console.ReadLine();
            if (IsOnlyLetters(str))
            {
                return str;
            }
            else
            {
                Console.WriteLine("Input must contain only letters");
                return GetOnlyLetters();
            }
        }
    }
}
